const state = { num: 10 }
const mutations = {
  adda(state, n = 1) {
    console.log(state, n)
    state.num += n
  },
  suba(state, n = 1) {
    state.num -= n
  }

}
const actions = {
  asyncsuba(context, n) {
    setTimeout(() => {
      context.commit('suba', n)
    }, 1000)
  },
  asyncadda(context, n) {
    setTimeout(() => {
      context.commit('adda', n)
    }, 1000)
  }
}

export default {

  state,
  mutations,
  actions
}
